﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.Configuration;

namespace  RzCorportativo
{
    public static class GridExtension
    {
        public static void SetPage(this GridView gridview, int index, object dataSource)
        {
            gridview.PageIndex = index;
            gridview.DataSource = dataSource;
            gridview.DataBind();
        }

        public static void SetSystemPageSize(this GridView gridview)
        {
            if (string.IsNullOrWhiteSpace(WebConfigurationManager.AppSettings["GridPageSize"]))
                gridview.PageSize = 10;
            else
                gridview.PageSize = int.Parse(WebConfigurationManager.AppSettings["GridPageSize"]);
        }
    }
}